#include <stdio.h>
#include <string.h>

int shu[1004];
int n;
int tt[1004];
int main()
{
	int i,j,tot,temp;
	
	memset(shu,0,sizeof(shu));
	memset(tt, 0,sizeof(tt));
	scanf("%d", &n);
	for (i=1;i<=n;i++)
		scanf("%d", &shu[i]);
	tt[1]=1;
	int max;
	for (i=2;i<=n;i++)
	{
		max=0;
		for (j=1;j<i;j++)
			if (shu[i]>shu[j] && tt[j]>max)
				max=tt[j];
		tt[i]=max+1;
	}
	max=0;
	for (i=1;i<=n;i++)
		if (max<tt[i])
			max=tt[i];
	printf("%d\n", max);
	return 0;
}